package com.xshang.SqlSession;

import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.List;


public interface SqlSession {

    /**
     * 查询多个结果
     * @param statementId
     * @param param
     * @return
     * @param <E>
     */
    <E> List<E>  selectList(String statementId, Object param) throws SQLException, IntrospectionException, NoSuchFieldException, ClassNotFoundException, InvocationTargetException, IllegalAccessException, InstantiationException;

    /**
     * 查询单个结果
     * @param statementId
     * @param param
     * @return
     * @param <T>
     */
    <T> T selectOne(String statementId, Object param) throws SQLException, IntrospectionException, NoSuchFieldException, ClassNotFoundException, InvocationTargetException, IllegalAccessException, InstantiationException;

    void close();

    /**
     * 生成代理对象
     * @param mapperClass
     * @return
     * @param <T>
     */
    <T> T getMapper(Class<?> mapperClass);
}
